<template>
  <el-container>
    <el-form class="detailForm" label-position="right" style="background-color:rgb(231, 231, 231)" ref="ruleForm" :model="ruleForm" :rules="rules" label-width="100px">
      <div>
        <span class="title">储值金额设定(元)</span>
        <el-row>
          <el-col>
            <el-form-item label="默认金额1" prop="defaultAmt1">
              <el-input v-model="ruleForm.cardConfigDetail[0].defaultAmt" placeholder="输入金额1" />
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="默认金额2" prop="defaultAmt2">
              <el-input v-model="ruleForm.cardConfigDetail[1].defaultAmt" placeholder="输入金额2" />
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="默认金额3" prop="defaultAmt3">
              <el-input v-model="ruleForm.cardConfigDetail[2].defaultAmt" placeholder="输入金额3" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="赠送金额1" prop="giveAmt1">
              <el-input v-model="ruleForm.cardConfigDetail[0].giveAmt" placeholder="输入金额1" />
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="赠送金额2" prop="giveAmt2">
              <el-input v-model="ruleForm.cardConfigDetail[1].giveAmt" placeholder="输入金额2" />
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="赠送金额3" prop="giveAmt3">
              <el-input v-model="ruleForm.cardConfigDetail[2].giveAmt" placeholder="输入金额3" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="是否引导注册充值" prop="guideFlag" label-width="130px">
              <el-select v-model="ruleForm.guideFlag" placeholder="">
                <el-option label="是" value="true" />
                <el-option label="否" value="false" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div>
        <span class="title">默认门店设置</span>
        <el-row>
          <el-col>
            <el-form-item label="请选择默认门店" prop="shopCode" label-width="130px">
              <el-select v-model="ruleForm.shopCode" placeholder="">
                <el-option label="是" value="true" />
                <el-option label="否" value="false" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div>
        <span class="title">会员密码管理</span>
        <el-row>
          <el-col>
            <el-form-item label="设置密码">
              <el-input v-model="ruleForm.password" placeholder="0" />
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item label="输入验证码">
              <el-input v-model="ruleForm.verifyCode" placeholder="0" />
            </el-form-item>
          </el-col>
          <el-col>
            <el-form-item>
              <el-button type="primary" @click="onSubmit">获取验证码</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <span class="title">操作记录</span>
      <div>
        <el-table :data="editData" border size="small" max-height="700">
          <el-table-column label="操作人" prop="user" header-align="center" align="center" width="120" />
          <el-table-column label="操作时间" prop="editTime" header-align="center" align="center" width="200" />
          <el-table-column label="操作内容" prop="content" header-align="center" align="center" width="120" />
        </el-table>
      </div>
      <el-form-item style="margin-top:20px">
        <el-button type="primary" style="float:left;margin-left:20%" @click="cancel">取消</el-button>
        <el-button type="primary" style="float:right;margin-right:30%" @click="saveCard">提交</el-button>
      </el-form-item>
    </el-form>
  </el-container>
</template>

<script>
import { memberAjax } from 'Ajax'
export default {
  name: 'MemberCard',
  data() {
    return {
      editData:[
        {
          user: '商户1',
          editTime: '2021-04-25 11:36:30',
          content: '修改状态',
        },
        {
          user: '商户1',
          editTime: '2021-04-26 23:36:30',
          content: '修改状态',
        }
      ],
      setUpTime: [],
      ruleForm: {
        cardConfigDetail: [
          {
            defaultAmt: 1,
            giveAmt: 1
          },
          {
            defaultAmt: 2,
            giveAmt: 2
          },
          {
            defaultAmt: 3,
            giveAmt: 3
          }
        ],
        guideFlag: '',
        shopCode: '',
        password: 234,
        verifyCode: ''
      },
      rules: {
        defaultAmt1: [
          { required: true, message: '请输入默认金额1', trigger: 'blur' }
        ],
        defaultAmt2: [
          { required: true, message: '请输入默认金额2', trigger: 'blur' }
        ],
        defaultAmt3: [
          { required: true, message: '请输入默认金额3', trigger: 'blur' }
        ],
        guideFlag: [
          { message: '请选择是否引导注册', trigger: 'blur' }
        ]
      }
    }
  },
  mounted(){
    memberAjax.cardDetailList().then(res => {
        this.ruleForm = res
        if(this.ruleForm.guideFlag){
          this.ruleForm.guideFlag = 'true'
        }else{
          this.ruleForm.guideFlag = 'false'
        }
      })
  },
  methods:{
    cancel(){

    },
    onSubmit(){

    },
    saveCard(){
      memberAjax.cardList(this.ruleForm).then(res => {
      })
    }
  }
}
</script>

<style scoped>
.el-col-24{
  width: 33%!important;
}
</style>
